package com.xc.h05.service.wutao.impl;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xc.h05.entity.Chargetype;
import com.xc.h05.mapper.ChargetypeMapper;
import com.xc.h05.service.wutao.ChargetypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ChargetypeServiceImpl implements ChargetypeService {
    @Autowired
    private ChargetypeMapper chargetypeMapper;


    @Override
    public int add(Chargetype chargetype) {
        int add = chargetypeMapper.add(chargetype);
        return add;
    }

    @Override
    public int delete(Integer id) {
        int delete = chargetypeMapper.delete(id);
        return delete;
    }

    @Override
    public int update(Chargetype chargetype) {
        int update = chargetypeMapper.update(chargetype);
        return update;
    }

    @Override
    public List<Chargetype> findAll() {
        List<Chargetype> list = chargetypeMapper.findAll();
        return list;
    }


    @Override
    public int deleteByIds(List<Integer> ids2) {
        int i = chargetypeMapper.deleteByIds(ids2);
        return i;
    }

@Override
public PageInfo<Chargetype> findByPage(int pageNum, int pageSize, Chargetype chargetype) {
    PageHelper.startPage(pageNum,pageSize);
    List<Chargetype> list = chargetypeMapper.findByPage(chargetype);
    PageInfo<Chargetype> pageInfo = new PageInfo<>(list);
    return pageInfo;
}
@Override
public Chargetype findById(Integer id) {
    Chargetype chargetype = chargetypeMapper.findById ( id );
    return chargetype;
}
}
